import Vue from 'vue'
import VueRouter from 'vue-router'
import blog_login from "@/views/blog_login";
import home from "@/views/home";
import Blog_articles from "@/components/Blog_articles";
import demo from "@/views/demo";
import vanta from "@/components/vanta";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/blog_login'
  },
  {
    path: '/blog_login',
    component: blog_login
  },
  {
    path: '/demo',
    component: demo
  },
  {
    path: '/vanta',
    component: vanta
  }
    ,
  {
    path:'/home',
    component: home,
    redirect: '/Blog_articles',
    children:[
      {path:'/Blog_articles',
      component:Blog_articles
      }
    ]
  }


]
const router = new VueRouter({
  routes,
  mode:'hash'
})


// router.beforeEach((to,from,next)=>{
//   const token=localStorage.getItem("token")
//   if (token!=null){
//     next()
//   }else {
//     if (to.path==='/blog_login'){
//       next()
//     }else {
//       next("/blog_login")
//     }
//   }
// })

export default router
